#ifndef CShaderObject_H
#define CShaderObject_H


//---STD-------------------------------------------------------------
#include <string>
#include <map>
#include <vector>

//---GL--------------------------------------------------------------
#include "CGlsl.h"

//---Using-----------------------------------------------------------
using std::map ;
using std::vector ;
using std::string ;

//-------------------------------------------------------------------

namespace SShader {

class CShaderObject : public GlslShader {

private:
  map<string, void*> m_vDataNormal ;
  map<string, void*> m_vDataColor ;
  map<string, void*> m_vData ;
  ///int * :  [0]  = type : [1]  = dimention
  map<string, int* >  m_vType ;
  map<string, int* >  m_vTypeColor ;
  map<string, int* >  m_vTypeNormal ;

  vector<unsigned int> m_vElementBuffer ;
  unsigned int m_uiElementBuffer ;
  unsigned int m_uiTailleElementBuffer ;
  int m_iMiseajour ;
  bool m_isVAO ;
  bool m_isCharged ;

protected:
  CShaderObject() ;
public:
  CShaderObject(string _sVertex, string _sPixel)  ;
  CShaderObject(const CShader &_shader)  ;
  CShaderObject(const CShaderObject &_copie)  ;
  ~CShaderObject() ;

  void setModeUpdate (int _iMiseajour) ;
  void setActiveVAO (bool _isActive) ;
  void initObject () ;

  void Draw(int _iAffichage) ;

  //---Element Buffer-----------------------------------------------------------
  void addIndex(unsigned int _uiValue) ;
  void setIndex(unsigned int _uiIndex, unsigned int _uiValue) ;
  //---Vertex-------------------------------------------------------------------
  bool addDonneVertex (string _sName, unsigned int  _data1, unsigned int  _data2,  unsigned int _data3, unsigned int _data4) ;
  bool addDonneVertex (string _sName, unsigned int  _data1, unsigned int  _data2, unsigned int _data3) ;
  bool addDonneVertex (string _sName, unsigned int  _data1, unsigned int  _data2) ;

  bool addDonneVertex (string _sName, int _data1, int _data2, int _data3, int _data4) ;
  bool addDonneVertex (string _sName, int _data1, int _data2, int _data3) ;
  bool addDonneVertex (string _sName, int _data1, int _data2) ;

  bool addDonneVertex (string _sName, float _data1, float _data2, float _data3, float _data4) ;
  bool addDonneVertex (string _sName, float _data1, float _data2, float _data3) ;
  bool addDonneVertex (string _sName, float _data1, float _data2) ;

  bool addDonneVertex (string _sName, bool _data1, bool _data2, bool _data3, bool _data4) ;
  bool addDonneVertex (string _sName, bool _data1, bool _data2, bool _data3) ;
  bool addDonneVertex (string _sName, bool _data1, bool _data2) ;

  //---Normal-------------------------------------------------------------------
  bool addDonneNormal (string _sName, unsigned int  _data1, unsigned int  _data2,  unsigned int _data3, unsigned int _data4) ;
  bool addDonneNormal (string _sName, unsigned int  _data1, unsigned int  _data2, unsigned int _data3) ;
  bool addDonneNormal (string _sName, unsigned int  _data1, unsigned int  _data2) ;

  bool addDonneNormal (string _sName, int _data1, int _data2, int _data3, int _data4) ;
  bool addDonneNormal (string _sName, int _data1, int _data2, int _data3) ;
  bool addDonneNormal (string _sName, int _data1, int _data2) ;

  bool addDonneNormal (string _sName, float _data1, float _data2, float _data3, float _data4) ;
  bool addDonneNormal (string _sName, float _data1, float _data2, float _data3) ;
  bool addDonneNormal (string _sName, float _data1, float _data2) ;

  bool addDonneNormal (string _sName, bool _data1, bool _data2, bool _data3, bool _data4) ;
  bool addDonneNormal (string _sName, bool _data1, bool _data2, bool _data3) ;
  bool addDonneNormal (string _sName, bool _data1, bool _data2) ;

  //---Color-------------------------------------------------------------------
  bool addDonneColor (string _sName, unsigned int  _data1, unsigned int  _data2,  unsigned int _data3, unsigned int _data4) ;
  bool addDonneColor (string _sName, unsigned int  _data1, unsigned int  _data2, unsigned int _data3) ;
  bool addDonneColor (string _sName, unsigned int  _data1, unsigned int  _data2) ;

  bool addDonneColor (string _sName, int _data1, int _data2, int _data3, int _data4) ;
  bool addDonneColor (string _sName, int _data1, int _data2, int _data3) ;
  bool addDonneColor (string _sName, int _data1, int _data2) ;

  bool addDonneColor (string _sName, float _data1, float _data2, float _data3, float _data4) ;
  bool addDonneColor (string _sName, float _data1, float _data2, float _data3) ;
  bool addDonneColor (string _sName, float _data1, float _data2) ;

  bool addDonneColor (string _sName, bool _data1, bool _data2, bool _data3, bool _data4) ;
  bool addDonneColor (string _sName, bool _data1, bool _data2, bool _data3) ;
  bool addDonneColor (string _sName, bool _data1, bool _data2) ;

};  //---CShaderObject
}   //---namespace SShader
#else
class CShaderObject ;
#endif







